package org.vserver.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * User: karpden ( Denis Karpov )
 * Date: 3/16/11
 * Time: 5:00 PM
 */
public class User  implements Serializable {
    private Long id;
    private String code;
    private String lastname;
    private String firstname;
    private Date birthday;
    private String sex;
    private String passwordHash;
    private String email;
    private List<String> roles;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getLastname() {
        return lastname;
    }
    public void setLastname(String lastname) {
        this.lastname = lastname;
    }
    public String getFirstname() {
        return firstname;
    }
    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getPasswordHash() {
        return passwordHash;
    }
    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public List<String> getRoles() {
        return roles;
    }
    public void setRoles(List<String> userRoles) {
        this.roles = userRoles;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("User{ ");
        sb.append("id=").append(id);
        sb.append(", code='").append(code).append('\'');
        sb.append(", lastname='").append(lastname).append('\'');
        sb.append(", firstname='").append(firstname).append('\'');
        sb.append(", birthday=").append(birthday);
        sb.append(", sex='").append(sex).append('\'');
        sb.append(", passwordHash='").append(passwordHash).append('\'');
        sb.append(", email='").append(email).append('\'');
        if (getRoles() != null) {
            sb.append(", roles={");
            for (String role : getRoles()) {
                sb.append('<').append(role).append('>');
            }
            sb.append("}");
        }
        sb.append("}");
        return sb.toString();
    }
}
